package org.example.springboot.service;

import org.example.springboot.entity.ExpertChat;
import org.example.springboot.repository.ExpertChatRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExpertChatService {
    @Autowired
    private ExpertChatRepository expertChatRepository;

    public List<ExpertChat> getChatHistory(Long expertId, Long userId) {
        return expertChatRepository.findByExpertIdAndUserId(expertId, userId);
    }

    public ExpertChat sendMessage(ExpertChat chat) {
        return expertChatRepository.save(chat);
    }
} 